#define _CRT_SECURE_NO_WARNINGS
using namespace std;
#include"VectorEmu.h"
#include"VectorEmu.cpp"//尝试引入源文件实现模板类，也可以合并写成.hpp
#include<iostream>

template<typename T>
void VectorPrt(const MyVector<T>& vec) {
	int sz = vec.capacity();
	 for(int i = 0; i < sz; i++)
        cout << vec.at(i) << " ";
		cout << "\n";
}

template<typename T>
inline void get_capsz(const MyVector<T>& vec) {
	cout << " size: " << vec.capacity()
		<< ",capacity: " << vec.size() << endl;
}

void test01() {//pushback
	MyVector<int> vec;
	get_capsz(vec);
	vec.push_back(1);
	vec.push_back(2);
	get_capsz(vec);
	vec.push_back(3);
	get_capsz(vec);
	vec.push_back(4);
	VectorPrt(vec);

}

void test02() { //pop
	MyVector<int> vec;
	vec.push_back(1);
	vec.push_back(2);
	vec.push_back(3);
	vec.push_back(4);
	VectorPrt(vec);
	vec.pop_back();
	VectorPrt(vec);
	vec.pop_back();
	VectorPrt(vec);
}

void test03() {//insert
	MyVector<int> vec;
	vec.push_back(1);
	vec.push_back(2);
	vec.push_back(3);
	vec.push_back(4);
	VectorPrt(vec);
	vec.insert(4, 5);//inser兼容尾插
	VectorPrt(vec);
	get_capsz(vec);
	vec.insert(3, 6);
	VectorPrt(vec);//正常中间插入
	get_capsz(vec);

}

void test04() {//remove
	MyVector<int> vec;
	vec.push_back(1);
	vec.push_back(2);
	vec.push_back(3);
	vec.push_back(4);
	vec.push_back(5);
	vec.push_back(6);
	vec.push_back(7);
	VectorPrt(vec);
	vec.remove(6);//客串尾删
	VectorPrt(aavec);
	vec.remove(3);
	VectorPrt(vec);//中间删除实现
}

int main() {
	//test01();
	//test02();
	//test03();
	test04();
	return 0;
}